<%--
  Created by IntelliJ IDEA.
  User: Master
  Date: 27.04.2011
  Time: 12:52:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.transcargo.users.Contact" %>
<%@ page import="com.transcargo.users.User" %>
<%@ page import="com.transcargo.users.Transport" %>
<%@ page import="com.transcargo.errors.ErrorList" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.transcargo.users.UserNotFoundException" %>
<%@ page import="com.transcargo.rating.Rating" %>
<%@ page import="com.transcargo.errors.ClientError" %>
<%@include file="header.jsf"%>
<%@include file="session.jsf"%>
<%
    if (User_Id <= 0) {
        response.sendRedirect("auth.jsp");
        return;
    }
	String uid = request.getParameter("uid");
	if (uid == null || uid.length() == 0 || Integer.parseInt(uid) == 0) {
		response.sendRedirect("index.jsp");
		return;
	}
	int Uid = Integer.parseInt(uid);
    if (Uid == User_Id) {
        response.sendRedirect("display_error.jsp?err=" + ClientError.ERROR_STR_COMPANY_NOT_EXIST.ordinal());
        return;
    }
    User client = null;
    Rating client_rating = null;
    try {
        client = new User(Uid, dbase);
        client_rating = new Rating(Uid, dbase);
    } catch (UserNotFoundException e) {
        response.sendRedirect("display_error.jsp?err=" + ClientError.ERROR_STR_SELF_FEEDBACK.ordinal());
        return;
    }

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  	<head><title>TransCargo</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="forms.js"></script>
	<link type="text/css" href="transcargo.css" rel="stylesheet"/>
  </head>
  <body>
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr><td>
			<%@include file="page_header.jsf"%>
        </td></tr>
        <tr><td align="center">
            Заявление о задолженности организации <b><%=client.getName()%></b><br>
            Рейтинг доверия организации: <b><%=client_rating.getRating()%></b><br><br>
			<div id="ErrorPlaceHolder" class="errorString"></div>
            <form action="AddDebtAction" method="POST" target="ifPost">
			<input type="hidden" name="uid" value="<%=Uid %>">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr class="tdFormSearch"><td>Текст отзыва:</td><td align="left"><textarea name="feedback" cols="60" rows="5"></textarea></td></tr>
                <tr><td class="tdFormSearch">&nbsp;</td><td align="left"><input type="submit" value="Поместить отзыв"><input type="submit" value="Отмена" onclick="history.go(-1);return false;"></td></tr>
            </table>
            </form>
        </td></tr>
        </table>
	<iframe name="ifPost" id="ifPost" width="0" height="0" style="visibility: hidden;width: 0;height: 0;" onload="handlePost(this);" onload="handlePost(this);"></iframe>
  </body>
</html>
